package bcxd.firstline.user;

import java.util.List;
import java.util.Map;

import org.limp.basework.AbstractSimpleBean;

import jt.classic.system.group.GroupManager;
import jt.classic.system.group.IGroup;
import jt.classic.system.role.IRole;
import jt.classic.system.user.IUser;
import jt.classic.system.wordbook.WordBookUtil;

/**
 * 应用用户
 * 
 * @author mido
 * 
 */
public class AppUser extends AbstractSimpleBean implements IUser {

	public List iallgroup() {
		// TODO Auto-generated method stub
		return (List) this.info.get("groups");
	}

	public String iallgroupflumeid(String smark) {
		// TODO Auto-generated method stub
		return GroupManager.ROOTID + smark + GroupManager.TEMPID;
	}

	public String ibirthday() {
		// TODO Auto-generated method stub
		return (String) this.info.get("UDATE");
	}

	public String id() {
		// TODO Auto-generated method stub
		return (String) this.info.get("ID");
	}

	public int iflag() {
		// TODO Auto-generated method stub
		return Integer.parseInt((String) this.info.get("USTATUS"));
	}

	public IGroup igroup() {
		// TODO Auto-generated method stub
		return (IGroup) ((List) this.info.get("groups")).get(0);
	}

	public String igroupflumeid(String smark) {
		// TODO Auto-generated method stub
		return GroupManager.TEMPID;
	}

	public String ijob() {
		// TODO Auto-generated method stub
		return "";
	}

	public String ijob(IGroup group) {
		// TODO Auto-generated method stub
		return "";
	}

	public String ilogid() {
		// TODO Auto-generated method stub
		return (String) this.info.get("LOGID");
	}

	public String imail() {
		// TODO Auto-generated method stub
		return "";
	}

	public String iname() {
		// TODO Auto-generated method stub
		return (String) this.info.get("UNAME");
	}

	public boolean inowhere() {
		// TODO Auto-generated method stub
		return false;
	}

	public String inumber() {
		// TODO Auto-generated method stub
		return "";
	}

	public int iorder() {
		// TODO Auto-generated method stub
		return 0;
	}

	public int iorder(IGroup group) {
		// TODO Auto-generated method stub
		return 0;
	}

	public boolean ipartgroup(String groupId) {
		// TODO Auto-generated method stub
		return false;
	}

	public boolean iparttime() {
		// TODO Auto-generated method stub
		return false;
	}

	public String iphone() {
		// TODO Auto-generated method stub
		return "";
	}

	public List iposts() {
		// TODO Auto-generated method stub
		return null;
	}

	public String ipwd() {
		// TODO Auto-generated method stub
		return (String) this.info.get("PWD");
	}

	public int irating() {
		// TODO Auto-generated method stub
		return 0;
	}

	public int irating(IGroup group) {
		// TODO Auto-generated method stub
		return -1;
	}

	public IRole irole(String key) {
		// TODO Auto-generated method stub
		IRole role = null;
		List list = (List) this.info.get("roles");

		if (list != null && !list.isEmpty()) {
			for (int i = 0; i < list.size(); i++) {
				IRole temp = (IRole) list.get(i);
				if (temp.ikey().equals(key)) {
					role = temp;
					break;
				}
			}
		}
		return role;
	}

	public List iroles() {
		// TODO Auto-generated method stub
		return (List) this.info.get("roles");
	}

	public String isex() {
		// TODO Auto-generated method stub
		return "";
	}

	public List isubgroup() {
		// TODO Auto-generated method stub
		return null;
	}

	public String itype() {
		// TODO Auto-generated method stub
		return (String) this.info.get("UTYPE");
	}

	public String itypelabel() {
		// TODO Auto-generated method stub
		return WordBookUtil.getWordBookItemName("bcxdUserType", (String) this.info.get("UTYPE"));
	}

	public void reload(Map arg0) {
		// TODO Auto-generated method stub
		if (arg0 != null) {
			this.info = arg0;
		}
	}

}
